<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/Bookkeeping.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Command to create a Bookkeeping
	*/
	class CommandCreateBookkeeping extends CustomCommand {
		/*
		* Constructor of the class
		*/
		public function __construct($debit,$havings,$pkNumberAccountingEntry,$pkNumberAccount,$fkLineBillDetail,$fkNumberBillDetail,$fkControlNumber,$fkcodeproduct,$fkRifBranch,$fkIdPurchase,$suplierPurchase,$fkCodeProductPurchase,$fkBranchInventory) {
			$this -> bookkeeping = new Bookkeeping($debit,$havings,$pkNumberAccountingEntry,$pkNumberAccount,$fkLineBillDetail,$fkNumberBillDetail,$fkControlNumber,$fkcodeproduct,$fkRifBranch,$fkIdPurchase,$suplierPurchase,$fkCodeProductPurchase,$fkBranchInventory);
		}
		
		/*
		* Method to execute to create a Bookkeeping
		*/
		public function execute() {
			$GLOBALS['debug']->log("entro al comando bookkeeping");	
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ibdad = $daoFactory -> getMySqlAccountAccessDao();
			$bookkeepingCreation = $ibdad -> createBookkeeping($this -> bookkeeping );
			
			$this -> result = $bookkeepingCreation;
			$GLOBALS['debug']->log("fin del comando bookeping");	
		}
	}
?>